﻿using System.Drawing;
using System.Windows.Forms;

namespace InfoPathHelpers.RepeatingTable.Paginator
{
    public class TextRendererTextMeasurer : ITextMeasurer
    {
        public TextRendererTextMeasurer() { }

        public TextRendererTextMeasurer(Font font)
        {
            Font = font;
        }

        public Font Font { get; set; }

        public int Measure(string text)
        {
            return TextRenderer.MeasureText(text, Font).Width;
        }

        public int Measure(string text, Font font)
        {
            return TextRenderer.MeasureText(text, font).Width;
        }
    }
}
